home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume20 / psroff / part04 < prev    next >
Encoding:
Internet Message Format  |  1989-10-17  |  47.0 KB

  1. Subject:  v20i036:  Troff upgrade for PostScript, DiTroff compatibility, Part04/06
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: Chris Lewis <eci386!clewis@uunet.uu.net>
  7. Posting-number: Volume 20, Issue 36
  8. Archive-name: psroff/part04
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 4 (of 6)."
  17. # Contents:  genftable.ps lib.ps lj.c troff2.c
  18. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  19. if test -f 'genftable.ps' -a "${1}" != "-c" ; then 
  20.   echo shar: Will not clobber existing file \"'genftable.ps'\"
  21. else
  22. echo shar: Extracting \"'genftable.ps'\" \(13536 characters\)
  23. sed "s/^X//" >'genftable.ps' <<'END_OF_FILE'
  24. X%!
  25. X% genftable - Postcript program to produce font tables for ditroff.
  26. X%          Tables are output on the standard output file - which
  27. X%          needs to be captured by the host computer.
  28. X%
  29. X%          Note the routine "commondefs" which outputs local
  30. X%          defined (hand built) characters.
  31. X%
  32. X% Michael Rourke, University of N.S.W., Australia
  33. X% (included in troff2: 1.2 89/08/25)
  34. X
  35. X/t 30 string def
  36. X
  37. X(Starting genftable.ps\n) print
  38. X
  39. X/ps
  40. X% string ->
  41. X{
  42. X    print
  43. X} def
  44. X
  45. X/pr
  46. X% any -->
  47. X{
  48. X    t cvs ps
  49. X} def
  50. X
  51. X/prsp
  52. X{
  53. X    (\t) ps
  54. X} def
  55. X
  56. X/prnl
  57. X{
  58. X    (\n) ps
  59. X} def
  60. X
  61. X/pro
  62. X% int -->
  63. X{
  64. X    dup 0 eq
  65. X    { pr }
  66. X    { dup 8 idiv pro 8 mod pr }
  67. X    ifelse
  68. X} def
  69. X
  70. X/charsize
  71. X% string --> bot top
  72. X{
  73. X    gsave
  74. X    newpath 0 0 moveto false charpath flattenpath pathbbox
  75. X    exch pop 3 -1 roll pop
  76. X    grestore
  77. X} def
  78. X
  79. X/strwidth
  80. X% string --> width
  81. X{
  82. X    stringwidth pop round cvi
  83. X} def
  84. X
  85. X/prsize
  86. X% string -->
  87. X{
  88. X    dup strwidth pr prsp
  89. X    dup charsize
  90. X    top gt { 2 } { 0 } ifelse
  91. X    exch bot lt { 1 or } if
  92. X    pr prsp
  93. X    0 get pro 
  94. X} def
  95. X
  96. X/fontinfo
  97. X% fontname troffinternal troffname
  98. X{
  99. X    (\ncat <<"!" > ) ps dup pr prnl
  100. X    (# ) ps 2 index pr prnl
  101. X    (name ) ps pr prnl
  102. X    (internalname ) ps pr prnl
  103. X    dup findfont 100 scalefont setfont
  104. X    /fixedwidth false def
  105. X    /Symbol eq
  106. X    {
  107. X        /actions symbol-encoding def
  108. X        (special\n) ps
  109. X    }
  110. X    {
  111. X        /actions standard-encoding def
  112. X        currentfont /FontInfo get /isFixedPitch get
  113. X        {
  114. X            (# fixed width\n) ps
  115. X            /fixedwidth true def
  116. X        }
  117. X        {
  118. X            (ligatures fi fl ff ffi ffl 0\n) ps
  119. X        }
  120. X        ifelse
  121. X    }
  122. X    ifelse
  123. X    % use "o" to get top and bottom on a normal char
  124. X    (o) charsize /top exch def /bot exch def
  125. X    % some non ascending chars slightly higher than "o"
  126. X    % and some lower so adjust slightly
  127. X    /top top 2 add def
  128. X    /bot bot 4 sub def
  129. X    /encoding currentfont /Encoding get def
  130. X    /s 1 string def
  131. X    0 1 255
  132. X    {
  133. X        s 0 2 index put
  134. X        encoding exch get dup /.notdef ne
  135. X        {
  136. X            s 1 index actions exch get
  137. X            % charname charstr
  138. X            exec
  139. X            flush
  140. X        }
  141. X        {
  142. X            pop
  143. X        }        
  144. X        ifelse
  145. X    } for
  146. X    actions standard-encoding eq { commondefs } if
  147. X    (!\n) ps flush
  148. X} def
  149. X
  150. X/commondefs
  151. X{
  152. X    /fracsize (0) strwidth (\244) strwidth add def        % \244 = '/'
  153. X    /Fisize (f) strwidth (\256) strwidth add 5 sub def    % \256 = 'fi'
  154. X    /ffsize (f) strwidth 2 mul 5 sub def
  155. X    /fl { flush } def
  156. X    fixedwidth not
  157. X    {
  158. X        (ff) ps prsp ffsize pr (\t2\t0100\tff ligature - faked\n) ps fl
  159. X        (Fi) ps prsp Fisize pr (\t2\t0100\tffi ligature - faked\n) ps fl
  160. X        (Fl) ps prsp Fisize pr (\t2\t0100\tffl ligature - faked\n) ps fl
  161. X    } if
  162. X    (12) ps prsp fracsize pr (\t2\t0100\t1/2 - faked\n) ps fl
  163. X    (13) ps prsp fracsize pr (\t2\t0100\t1/3 - faked\n) ps fl
  164. X    (14) ps prsp fracsize pr (\t2\t0100\t1/4 - faked\n) ps fl
  165. X    (18) ps prsp fracsize pr (\t2\t0100\t1/8 - faked\n) ps fl
  166. X    (23) ps prsp fracsize pr (\t2\t0100\t2/3 - faked\n) ps fl
  167. X    (34) ps prsp fracsize pr (\t2\t0100\t3/4 - faked\n) ps fl
  168. X    (38) ps prsp fracsize pr (\t2\t0100\t3/8 - faked\n) ps fl
  169. X    (58) ps prsp fracsize pr (\t2\t0100\t5/8 - faked\n) ps fl
  170. X    (78) ps prsp fracsize pr (\t2\t0100\t7/8 - faked\n) ps fl
  171. X    (sq\t100\t3\t0100\tsquare box - faked\n) ps fl
  172. X} def
  173. X
  174. X/space
  175. X% charname charstr -->
  176. X{
  177. X    (spacewidth ) ps
  178. X    strwidth pr pop prnl
  179. X    (charset\n) ps
  180. X} def
  181. X
  182. X/norm
  183. X% charname charstr -->
  184. X{
  185. X    dup pr prsp prsize pop prnl
  186. X} def
  187. X
  188. X/normdup
  189. X% charname charstr dupname -->
  190. X{
  191. X    3 1 roll norm
  192. X    pr prsp (") ps prnl
  193. X} def
  194. X
  195. X/gnorm
  196. X% charname charstr -->
  197. X{
  198. X    (*) ps norm
  199. X} def
  200. X
  201. X/map
  202. X% charname charstr mapname -->
  203. X{
  204. X    pr prsp prsize prsp pr prnl
  205. X} def
  206. X
  207. X/mapdup
  208. X% charname charstr mapname dupname -->
  209. X{
  210. X    4 1 roll map
  211. X    pr prsp (") ps prnl
  212. X} def
  213. X
  214. X/mapdupdup
  215. X% charname charstr mapname dupname dupname -->
  216. X{
  217. X    5 1 roll mapdup
  218. X    pr prsp (") ps prnl
  219. X} def
  220. X
  221. X/cmap
  222. X% charname charstr mapname -->
  223. X{
  224. X    fixedwidth { 3 { pop } repeat } { map } ifelse
  225. X} def
  226. X
  227. X/standard-encoding 149 dict def
  228. Xstandard-encoding begin
  229. X    /space        { space }        def
  230. X    /exclam        { norm }        def
  231. X    /quotedbl    { norm }        def
  232. X    /numbersign    { norm }        def
  233. X    /dollar        { norm }        def
  234. X    /percent    { norm }        def
  235. X    /ampersand    { norm }        def
  236. X    /quoteright    { norm }        def
  237. X    /parenleft    { norm }        def
  238. X    /parenright    { norm }        def
  239. X    /asterisk    { norm }        def
  240. X    /plus        { norm }        def
  241. X    /comma        { norm }        def
  242. X    /hyphen        { (hy) normdup }    def
  243. X    /period        { norm }        def
  244. X    /slash        { (sl) dup }        def
  245. X    /zero        { norm }        def
  246. X    /one        { norm }        def
  247. X    /two        { norm }        def
  248. X    /three        { norm }        def
  249. X    /four        { norm }        def
  250. X    /five        { norm }        def
  251. X    /six        { norm }        def
  252. X    /seven        { norm }        def
  253. X    /eight        { norm }        def
  254. X    /nine        { norm }        def
  255. X    /colon        { norm }        def
  256. X    /semicolon    { norm }        def
  257. X    /less        { norm }        def
  258. X    /equal        { norm }        def
  259. X    /greater    { norm }        def
  260. X    /question    { norm }        def
  261. X    /at        { norm }        def
  262. X    /A        { norm }        def
  263. X    /B        { norm }        def
  264. X    /C        { norm }        def
  265. X    /D        { norm }        def
  266. X    /E        { norm }        def
  267. X    /F        { norm }        def
  268. X    /G        { norm }        def
  269. X    /H        { norm }        def
  270. X    /I        { norm }        def
  271. X    /J        { norm }        def
  272. X    /K        { norm }        def
  273. X    /L        { norm }        def
  274. X    /M        { norm }        def
  275. X    /N        { norm }        def
  276. X    /O        { norm }        def
  277. X    /P        { norm }        def
  278. X    /Q        { norm }        def
  279. X    /R        { norm }        def
  280. X    /S        { norm }        def
  281. X    /T        { norm }        def
  282. X    /U        { norm }        def
  283. X    /V        { norm }        def
  284. X    /W        { norm }        def
  285. X    /X        { norm }        def
  286. X    /Y        { norm }        def
  287. X    /Z        { norm }        def
  288. X    /bracketleft    { norm }        def
  289. X    /backslash    { norm }        def
  290. X    /bracketright    { norm }        def
  291. X    /asciicircum    { (a^) map }        def
  292. X    /underscore    { (ru) normdup }    def
  293. X    /quoteleft    { norm }        def
  294. X    /a        { norm }        def
  295. X    /b        { norm }        def
  296. X    /c        { norm }        def
  297. X    /d        { norm }        def
  298. X    /e        { norm }        def
  299. X    /f        { norm }        def
  300. X    /g        { norm }        def
  301. X    /h        { norm }        def
  302. X    /i        { norm }        def
  303. X    /j        { norm }        def
  304. X    /k        { norm }        def
  305. X    /l        { norm }        def
  306. X    /m        { norm }        def
  307. X    /n        { norm }        def
  308. X    /o        { norm }        def
  309. X    /p        { norm }        def
  310. X    /q        { norm }        def
  311. X    /r        { norm }        def
  312. X    /s        { norm }        def
  313. X    /t        { norm }        def
  314. X    /u        { norm }        def
  315. X    /v        { norm }        def
  316. X    /w        { norm }        def
  317. X    /x        { norm }        def
  318. X    /y        { norm }        def
  319. X    /z        { norm }        def
  320. X    /braceleft    { norm }        def
  321. X    /bar        { norm }        def
  322. X    /braceright    { norm }        def
  323. X    /asciitilde    { (a~) map }        def
  324. X    /exclamdown    { (I!) map }        def
  325. X    /cent        { (ct) map }        def
  326. X    /sterling    { (po) map }        def
  327. X    /fraction    { }            def
  328. X    /yen        { ($J) map }        def
  329. X    /florin        { }            def
  330. X    /section    { (sc) map }        def
  331. X    /currency    { }            def
  332. X    /quotesingle    { (fm) (n') mapdup }    def
  333. X    /quotedblleft    { (lq) map }        def
  334. X    /guillemotleft    { (d<) map }        def
  335. X    /guilsinglleft    { (l<) map }        def
  336. X    /guilsinglright    { (r>) map }        def
  337. X    /fi        { (fi) cmap }        def
  338. X    /fl        { (fl) cmap }        def
  339. X    /endash        { (\\-) map }        def
  340. X    /dagger        { (dg) map }        def
  341. X    /daggerdbl    { (dd) map }        def
  342. X    /periodcentered    { }            def
  343. X    /paragraph    { (pp) map }        def
  344. X    /bullet        { (bu) map }        def
  345. X    /quotesinglbase    { }             def
  346. X    /quotedblbase    { }            def
  347. X    /quotedblright    { (rq) map }        def
  348. X    /guillemotright    { (d>) map }        def
  349. X    /ellipsis    { }            def
  350. X    /perthousand    { (pm) cmap }        def
  351. X    /questiondown    { (I?) map }        def
  352. X    /grave        { (ga) (\\`) mapdup }    def
  353. X    /acute        { (aa) (\\') mapdup }    def
  354. X    /circumflex    { (^) map }        def
  355. X    /tilde        { (~) map }        def
  356. X    /macron        { (ma) map }        def
  357. X    /breve        { (be) map }        def
  358. X    /dotaccent    { (dt) map }        def
  359. X    /dieresis    { (..) (um) mapdup }    def
  360. X    /ring        { (ri) map }        def
  361. X    /cedilla    { (cd) map }        def
  362. X    /hungarumlaut    { ('') map }        def
  363. X    /ogonek        { (og) map }        def
  364. X    /caron        { (hc) map }        def
  365. X    /emdash        { (em) map }        def
  366. X    /AE        { (AE) cmap }        def
  367. X    /ordfeminine    { }            def
  368. X    /Lslash        { (PL) map }        def
  369. X    /Oslash        { (O/) map }        def
  370. X    /OE        { (OE) cmap }        def
  371. X    /ordmasculine    { }            def
  372. X    /ae        { (ae) cmap }        def
  373. X    /dotlessi    { (ui) map }        def
  374. X    /lslash        { (Pl) map }        def
  375. X    /oslash        { (o/) map }        def
  376. X    /oe        { (oe) cmap }        def
  377. X    /germandbls    { (ss) map }        def
  378. Xend
  379. X
  380. X/symbol-encoding 189 dict def
  381. Xsymbol-encoding begin
  382. X    /space        { space }        def
  383. X    /exclam        { norm }        def
  384. X    /universal    { (fa) map }        def
  385. X    /numbersign    { norm }        def
  386. X    /existential    { (te) map }        def
  387. X    /percent    { norm }        def
  388. X    /ampersand    { norm }        def
  389. X    /suchthat    { (cm) map }        def
  390. X    /parenleft    { norm }        def
  391. X    /parenright    { norm }        def
  392. X    /asteriskmath    { (**) map }        def
  393. X    /plus        { (pl) map }        def
  394. X    /comma        { norm }        def
  395. X    /minus        { (mi) normdup }    def
  396. X    /period        { norm }        def
  397. X    /slash        { (sl) map }        def
  398. X    /zero        { norm }        def
  399. X    /one        { norm }        def
  400. X    /two        { norm }        def
  401. X    /three        { norm }        def
  402. X    /four        { norm }        def
  403. X    /five        { norm }        def
  404. X    /six        { norm }        def
  405. X    /seven        { norm }        def
  406. X    /eight        { norm }        def
  407. X    /nine        { norm }        def
  408. X    /colon        { norm }        def
  409. X    /semicolon    { norm }        def
  410. X    /less        { norm }        def
  411. X    /equal        { (eq) normdup }    def
  412. X    /greater    { norm }        def
  413. X    /question    { norm }        def
  414. X    /congruent    { (=~) map }        def
  415. X    /Alpha        { gnorm }        def
  416. X    /Beta        { gnorm }        def
  417. X    /Chi        { (*X) map }        def
  418. X    /Delta        { gnorm }        def
  419. X    /Epsilon    { gnorm }        def
  420. X    /Phi        { gnorm }        def
  421. X    /Gamma        { gnorm }        def
  422. X    /Eta        { (*Y) map }        def
  423. X    /Iota        { gnorm }        def
  424. X    /theta1        { }            def
  425. X    /Kappa        { gnorm }        def
  426. X    /Lambda        { gnorm }        def
  427. X    /Mu        { gnorm }        def
  428. X    /Nu        { gnorm }        def
  429. X    /Omicron    { gnorm }        def
  430. X    /Pi        { gnorm }        def
  431. X    /Theta        { (*H) map }        def
  432. X    /Rho        { gnorm }        def
  433. X    /Sigma        { gnorm }        def
  434. X    /Tau        { gnorm }        def
  435. X    /Upsilon    { gnorm }        def
  436. X    /sigma1        { (ts) map }        def
  437. X    /Omega        { (*W) map }        def
  438. X    /Xi        { (*C) map }        def
  439. X    /Psi        { (*Q) map }        def
  440. X    /Zeta        { gnorm }        def
  441. X    /bracketleft    { norm }        def
  442. X    /therefore    { (tf) map }        def
  443. X    /bracketright    { norm }        def
  444. X    /perpendicular    { (bt) map }        def
  445. X    /underscore    { (ul) map }        def
  446. X    /radicalex    { }            def
  447. X    /alpha        { gnorm }        def
  448. X    /beta        { gnorm }        def
  449. X    /chi        { (*x) map }        def
  450. X    /delta        { gnorm }        def
  451. X    /epsilon    { gnorm }        def
  452. X    /phi        { gnorm }        def
  453. X    /gamma        { gnorm }        def
  454. X    /eta        { (*y) map }        def
  455. X    /iota        { gnorm }        def
  456. X    /phi1        { }            def
  457. X    /kappa        { gnorm }        def
  458. X    /lambda        { gnorm }        def
  459. X    /mu        { gnorm }        def
  460. X    /nu        { gnorm }        def
  461. X    /omicron    { gnorm }        def
  462. X    /pi        { gnorm }        def
  463. X    /theta        { (*h) map }        def
  464. X    /rho        { gnorm }        def
  465. X    /sigma        { gnorm }        def
  466. X    /tau        { gnorm }        def
  467. X    /upsilon    { gnorm }        def
  468. X    /omega1        { }            def
  469. X    /omega        { (*w) map }        def
  470. X    /xi        { (*c) map }        def
  471. X    /psi        { (*q) map }        def
  472. X    /zeta        { gnorm }        def
  473. X    /braceleft    { norm }        def
  474. X    /bar        { (or) normdup }    def
  475. X    /braceright    { norm }        def
  476. X    /similar    { (ap) map }        def
  477. X    /Upsilon1    { }            def
  478. X    /minute        { (mt) map }        def
  479. X    /lessequal    { (<=) map }        def
  480. X    /fraction    { (/) map }        def
  481. X    /infinity    { (if) map }        def
  482. X    /florin        { }            def
  483. X    /club        { (Cc) map }        def
  484. X    /diamond    { (Cd) map }        def
  485. X    /heart        { (Ch) map }        def
  486. X    /spade        { (Cs) map }        def
  487. X    /arrowboth    { (<>) map }        def
  488. X    /arrowleft    { (<-) map }        def
  489. X    /arrowup    { (ua) map }        def
  490. X    /arrowright    { (->) map }        def
  491. X    /arrowdown    { (da) map }        def
  492. X    /degree        { (de) map }        def
  493. X    /plusminus    { (+-) map }        def
  494. X    /second        { (sd) map }        def
  495. X    /greaterequal    { (>=) map }        def
  496. X    /multiply    { (mu) map }        def
  497. X    /proportional    { (pt) map }        def
  498. X    /partialdiff    { (pd) map }        def
  499. X    /bullet        { }            def
  500. X    /divide        { (di) map }        def
  501. X    /notequal    { (!=) map }        def
  502. X    /equivalence    { (==) map }        def
  503. X    /approxequal    { (~=) map }        def
  504. X    /ellipsis    { }            def
  505. X    /arrowvertex    { }            def
  506. X    /arrowhorizex    { }            def
  507. X    /carriagereturn    { (cr) map }        def
  508. X    /aleph        { (al) map }        def
  509. X    /Ifraktur    { }            def
  510. X    /Rfraktur    { }            def
  511. X    /weierstrass    { }            def
  512. X    /circlemultiply    { (ax) map }        def
  513. X    /circleplus    { (a+) map }        def
  514. X    /emptyset    { (es) map }        def
  515. X    /intersection    { (ca) map }        def
  516. X    /union        { (cu) map }        def
  517. X    /propersuperset    { (sp) map }        def
  518. X    /reflexsuperset    { (ip) map }        def
  519. X    /notsubset    { (!s) map }        def
  520. X    /propersubset    { (sb) map }        def
  521. X    /reflexsubset    { (ib) map }        def
  522. X    /element    { (mo) map }        def
  523. X    /notelement    { (!m) (nm) mapdup }    def
  524. X    /angle        { (ag) map }        def
  525. X    /gradient    { (gr) map }        def
  526. X    /registerserif    { }            def
  527. X    /copyrightserif    { }            def
  528. X    /trademarkserif    { }            def
  529. X    /product    { }            def
  530. X    /radical    { (sr) map }        def
  531. X    /dotmath    { (m.) map }        def
  532. X    /logicalnot    { (no) map }        def
  533. X    /logicaland    { (an) (la) mapdup }    def
  534. X    /logicalor    { (lo) map }        def
  535. X    /arrowdblboth    { (io) map }        def
  536. X    /arrowdblleft    { (<:) (lh) mapdup }    def
  537. X    /arrowdblup    { (u=) map }        def
  538. X    /arrowdblright    { (:>) (rh) (im) mapdupdup } def
  539. X    /arrowdbldown    { (d=) map }        def
  540. X    /lozenge    { (dm) map }        def
  541. X    /angleleft    { (L<) map }        def
  542. X    /registersans    { (rg) map }        def
  543. X    /copyrightsans    { (co) map }        def
  544. X    /trademarksans    { (tm) map }        def
  545. X    /summation    { }            def
  546. X    /parenlefttp    { }            def
  547. X    /parenleftex    { }            def
  548. X    /parenleftbt    { }            def
  549. X    /bracketlefttp    { }            def
  550. X    /bracketleftex    { }            def
  551. X    /bracketleftbt    { }            def
  552. X    /bracelefttp    { }            def
  553. X    /braceleftmid    { }            def
  554. X    /braceleftbt    { }            def
  555. X    /braceex    { }            def
  556. X    /apple        { (AL) map }        def
  557. X    /angleright    { (R>) map }        def
  558. X    /integral    { (is) map }        def
  559. X    /integraltp    { }            def
  560. X    /integralex    { }            def
  561. X    /integralbt    { }            def
  562. X    /parenrighttp    { }            def
  563. X    /parenrightex    { }            def
  564. X    /parenrightbt    { }            def
  565. X    /bracketrighttp    { }            def
  566. X    /bracketrightex    { }            def
  567. X    /bracketrightbt    { }            def
  568. X    /bracerighttp    { }            def
  569. X    /bracerightmid    { }            def
  570. X    /bracerightbt    { }            def
  571. Xend
  572. X
  573. X/Times-Roman        /Roman        /R    fontinfo
  574. X/Helvetica        /Helvetica    /H    fontinfo
  575. X/Courier        /Courier    /C    fontinfo
  576. X/Symbol            /Symbol        /S    fontinfo
  577. X/Times-Italic        /Italic        /I    fontinfo
  578. X/Times-Bold        /Bold        /B    fontinfo
  579. X/Times-BoldItalic    /BoldI        /BI    fontinfo
  580. X/Helvetica-Bold        /HelveticaB    /HB    fontinfo
  581. X/Helvetica-Oblique    /HelveticaO    /HO    fontinfo
  582. X/Helvetica-BoldOblique    /HelveticaBO    /HX    fontinfo
  583. X/Courier-Bold        /CourierB    /CB    fontinfo
  584. X/Courier-Oblique    /CourierO    /CO    fontinfo
  585. X/Courier-BoldOblique    /CourierBO    /CX    fontinfo
  586. X/Helvetica-Narrow    /HelvNarHn    /Hn    fontinfo
  587. X/Helvetica-Narrow-Oblique /HelvNarHo    /Ho    fontinfo
  588. X/Helvetica-Narrow-BoldOblique    /HelvNarHx    /Hx    fontinfo
  589. X/ZapfChancery-MediumItalic    /ZapfC    /ZC    fontinfo
  590. X/AvantGarde-Book    /AvantAR    /AR    fontinfo
  591. X/AvantGarde-BookOblique    /AvantAX    /AX    fontinfo
  592. X/AvantGarde-Demi    /AvantAB    /AB    fontinfo
  593. X/AvantGarde-DemiItalic    /AvantAI    /AI    fontinfo
  594. X/Palatino-Roman    /PalatPR    /PR    fontinfo
  595. X/Palatino-Bold    /PalatPB    /PB    fontinfo
  596. X/Palatino-BoldItalic /PalatPX    /PX    fontinfo
  597. X/Palatino-Italic /PalatPI    /PI    fontinfo
  598. X/NewCenturySchlbk-Bold        /NB    fontinfo
  599. X/NewCenturySchlbk-BoldItalic    /NX    fontinfo
  600. X/NewCenturySchlbk-Italic    /NI    fontinfo
  601. X/NewCenturySchlbk-Roman        /NR    fontinfo
  602. END_OF_FILE
  603. if test 13536 -ne `wc -c <'genftable.ps'`; then
  604.     echo shar: \"'genftable.ps'\" unpacked with wrong size!
  605. fi
  606. # end of 'genftable.ps'
  607. fi
  608. if test -f 'lib.ps' -a "${1}" != "-c" ; then 
  609.   echo shar: Will not clobber existing file \"'lib.ps'\"
  610. else
  611. echo shar: Extracting \"'lib.ps'\" \(9920 characters\)
  612. sed "s/^X//" >'lib.ps' <<'END_OF_FILE'
  613. X%    Copyright 1985, 1986, 1987, 1988 Chris Lewis
  614. X%        All Rights Reserved
  615. X%
  616. X%    Permission to copy and further distribute is freely given provided 
  617. X%    this copyright notice remains intact and that this software is not 
  618. X%    sold for profit.
  619. X%
  620. X%    Project:    Generic Troff drivers
  621. X%    Module:        lib.ps
  622. X%    Author:     Chris Lewis
  623. X%    Specs:        Predefinitions for PostScript
  624. X%ident  @(#)lib.ps: 1.16 Copyright 89/07/04 16:59:33 Chris Lewis"
  625. X
  626. X/Y { 3 1 roll dup /CurY exch def moveto show } def
  627. X/X { exch CurY moveto show } def
  628. X
  629. X/Hits    10 string def
  630. XHits 0 0 1 string cvs putinterval
  631. X/Misses    10 string def
  632. XMisses 0 0 1 string cvs putinterval
  633. X
  634. X/drawfraction {
  635. X    /denominator exch def
  636. X    /numerator exch def
  637. X    /origY exch def
  638. X    /origX exch def
  639. X    origX curPoints 4 div add origY moveto
  640. X    (/) show
  641. X    curFont findfont curPoints .5 mul cvi scalefont setfont
  642. X    origX origY curPoints 4 div add moveto
  643. X    numerator show
  644. X    origX curPoints 2 div add origY moveto
  645. X    denominator show
  646. X    curFont findfont curPoints scalefont setfont
  647. X    origX origY moveto
  648. X} def
  649. X
  650. X/mySetLineWidth {
  651. X    curPoints 3 72 div mul setlinewidth
  652. X} def
  653. X
  654. X/do12 {
  655. X    (1) (2) drawfraction
  656. X} def
  657. X
  658. X/do14 {
  659. X    (1) (4) drawfraction
  660. X} def
  661. X
  662. X/do34 {
  663. X    (3) (4) drawfraction
  664. X} def
  665. X
  666. X/doff {
  667. X    moveto
  668. X    (f) show curPoints 20 div neg 0 rmoveto (f) show
  669. X} def
  670. X
  671. X/doFi {
  672. X    moveto
  673. X    (f) show curPoints 20 div neg 0 rmoveto (\256) show
  674. X} def
  675. X
  676. X/doFl {
  677. X    moveto
  678. X    (f) show curPoints 20 div neg 0 rmoveto (\257) show
  679. X} def
  680. X
  681. X%    This should be sort of a font-caching mechanism - eg:
  682. X%    remember each font/point combination requested, and
  683. X%    if the setting is not already known, *then* do the findfont/scalefont.
  684. X%    Otherwise, simply retrieve it.
  685. X%    However, even with simply recalculating the font each time, it
  686. X%    isn't *that* slow.  Eg: 20 seconds or so for *very* "font-changy"
  687. X%    pages.
  688. X%
  689. X%    Trial font cache - I can't think in Polish... ;-)
  690. X/SetFont {
  691. X    /curPoints exch def
  692. X    /curFont exch def
  693. X    %    Concatenate the curFont string with the curPoints to create
  694. X    %    a new name and assign to cF
  695. X
  696. X    /cF 50 string def 
  697. X
  698. X    cF 0
  699. X        cF curFont cF cvs        % cF 0 string "curFont"
  700. X        length dup            % cF 0 "curFont\0\0..." N N
  701. X        curPoints 10 string cvs    % cF 0 "curFont\0\0..." N N "points"
  702. X        dup length            % cF 0 "curFont\0\0..." N N "points" M
  703. X        3 -1 roll add        % cF 0 "curFont\0\0..." N "points" M+N
  704. X        4 1 roll            % cF 0 M+N "curFont\0\0..." N "points"
  705. X        putinterval            % cF 0 M+N    (cF <- "curFontpoints")
  706. X    getinterval                % "curFontpoints"
  707. X
  708. X    /cF exch def
  709. X    cF
  710. X    cvn                    % /curFontpoints
  711. X
  712. X    where {
  713. X    /hits hits 1 add def
  714. X    pop 
  715. X    } {
  716. X    /misses misses 1 add def
  717. X    cF curFont findfont curPoints scalefont def
  718. X    } ifelse
  719. X    cF load setfont
  720. X} def
  721. X
  722. X/docircle {
  723. X    /origY exch def
  724. X    /origX exch def
  725. X    /radius curPoints 3 div def
  726. X    newpath origX radius add origY radius add radius 0 360 arc 
  727. X    mySetLineWidth
  728. X    stroke
  729. X    origX origY moveto
  730. X} def
  731. X
  732. X/doru {
  733. X    moveto
  734. X    0 curPoints 5 div rmoveto (_) show
  735. X} def
  736. X
  737. X/do34em {
  738. X    /origY exch def
  739. X    /origX exch def
  740. X    /emheight curPoints .23 mul def
  741. X    newpath
  742. X    origX origY emheight add moveto
  743. X    origX curPoints .75 mul add origY emheight add lineto
  744. X    mySetLineWidth
  745. X    stroke
  746. X    origX origY moveto
  747. X} def
  748. X
  749. X/dosq {
  750. X    /origY exch def
  751. X    /origX exch def
  752. X    /L (M) stringwidth pop 3 div def
  753. X    newpath
  754. X    origX origY moveto
  755. X    origX origY L add lineto
  756. X    origX L add origY L add lineto
  757. X    origX L add origY lineto
  758. X    closepath
  759. X    mySetLineWidth
  760. X    stroke
  761. X    origX origY moveto
  762. X} def
  763. X
  764. X/dobox {
  765. X    /origY exch def
  766. X    /origX exch def
  767. X    /L curPoints def
  768. X    newpath
  769. X    origX origY moveto
  770. X    origX origY L add lineto
  771. X    origX L add origY L add lineto
  772. X    origX L add origY lineto
  773. X    closepath
  774. X    1 setlinewidth
  775. X    stroke
  776. X    origX origY moveto
  777. X} def
  778. X
  779. X
  780. X/fourpops {
  781. X    4 {pop} repeat
  782. X} def
  783. X
  784. X%    These are macros so that they can be redefined.
  785. X%    print current page.
  786. X/ShowPage {
  787. X    Misses dup cvi misses add 10 string cvs 0 exch putinterval
  788. X    Hits dup cvi hits add 10 string cvs 0 exch putinterval
  789. X    showpage
  790. X} def
  791. X
  792. X%    Emitted at beginning of page.
  793. X/StartPage {
  794. X    /hits 0 def
  795. X    /misses 0 def
  796. X    Form
  797. X} def
  798. X
  799. X%    If you want to define a Bell System Logo, go ahead.  This
  800. X%    one draws an animal (ferret) face
  801. X%    Object should be scaled off of curPoints, with origX,origY
  802. X%    lower left coordinates.
  803. X/BellSymbol {
  804. X    /origY exch def
  805. X    /origX exch def
  806. X    /TEMPSAVE save def
  807. X
  808. X    /Radius curPoints 2 div def    % Face Radius
  809. X    /HRadius Radius 2 div def    % Half Face Radius
  810. X    /NRadius Radius 6 div def    % Nose Radius
  811. X    /ERadius Radius 8 div def    % Eye Radius
  812. X    /EarRadius Radius 3 div def    % Ear Radius
  813. X    /FaceType (Ferret) def
  814. X
  815. X    /MRadius Radius 4 div def    % Mask corner radius
  816. X    /TopMask Radius .7 mul def    % XCent & YCent max delta
  817. X    /BotMask NRadius 1.1 mul def % YCent min delta
  818. X
  819. X    /XCent origX Radius add def
  820. X    /YCent origY Radius add def
  821. X
  822. X    newpath
  823. X    %    Main face
  824. X    XCent YCent Radius 0 360 arc mySetLineWidth stroke
  825. X    %    Nose
  826. X    XCent YCent NRadius 0 360 arc fill
  827. X    %    Left Ear
  828. X    XCent Radius 45 sin mul sub 
  829. X    YCent Radius 45 sin mul add EarRadius 20 250 arc mySetLineWidth stroke
  830. X    %    Right Ear
  831. X    XCent Radius 45 sin mul add 
  832. X    YCent Radius 45 sin mul add EarRadius -70 160 arc mySetLineWidth stroke
  833. X    %    Cleft
  834. X    XCent YCent NRadius sub moveto
  835. X    XCent YCent HRadius sub lineto 
  836. X    mySetLineWidth stroke
  837. X
  838. X    %    Mouth
  839. X    XCent HRadius 45 sin mul sub YCent HRadius 45 sin mul sub moveto
  840. X    XCent HRadius 30 sin mul sub YCent HRadius sub lineto
  841. X    XCent HRadius 30 sin mul add YCent HRadius sub lineto
  842. X    XCent HRadius 45 sin mul add YCent HRadius 45 sin mul sub lineto
  843. X    mySetLineWidth stroke
  844. X
  845. X    FaceType (Ferret) eq {
  846. X    %    Mask
  847. X    .6 setgray
  848. X    XCent TopMask sub YCent BotMask add YCent TopMask add add 2 div moveto
  849. X
  850. X    XCent TopMask sub YCent TopMask add 
  851. X        XCent TopMask add YCent TopMask add
  852. X        MRadius arcto fourpops
  853. X    XCent TopMask add YCent TopMask add
  854. X        XCent TopMask add YCent BotMask add
  855. X        MRadius arcto fourpops
  856. X    XCent TopMask add YCent BotMask add
  857. X        XCent TopMask sub YCent BotMask add
  858. X        MRadius arcto fourpops
  859. X    XCent TopMask sub YCent BotMask add
  860. X        XCent TopMask sub YCent TopMask add 
  861. X        MRadius arcto fourpops
  862. X    fill
  863. X
  864. X    0 setgray
  865. X    } if
  866. X    
  867. X    %    Eyes
  868. X    XCent HRadius add YCent HRadius add ERadius 0 360 arc fill
  869. X    XCent HRadius sub YCent HRadius add ERadius 0 360 arc fill
  870. X    TEMPSAVE restore
  871. X    origX origY moveto
  872. X} def
  873. X
  874. X%    bracket building font
  875. X%!
  876. X%
  877. X% Michael Rourke, University of N.S.W., Australia
  878. X%
  879. X/BracketFontDict 9 dict def /$workingdict 10 dict def
  880. XBracketFontDict begin
  881. X/FontType 3 def
  882. X/FontName (Bracket) cvn def
  883. X/FontMatrix [ 0.001 0 0 0.001 0 0] def
  884. X/FontBBox [ -50 -250 1000 1000 ] def
  885. X/Encoding 256 array def 0 1 255 { Encoding exch /.notdef put } for
  886. XEncoding
  887. Xdup 65 /Cbv put    %A
  888. Xdup 66 /Clt put    %B
  889. Xdup 67 /Clk put    %C
  890. Xdup 68 /Clb put    %D
  891. Xdup 69 /Crt put    %E
  892. Xdup 70 /Crk put    %F
  893. Xdup 71 /Crb put    %G
  894. Xdup 72 /Clc put    %H
  895. Xdup 73 /Clf put    %I
  896. Xdup 74 /Crc put    %J
  897. Xdup 75 /Crf put    %K
  898. Xdup 76 /Cbr put    %L
  899. Xdup 77 /Crn put    %M
  900. Xdup 78 /Cci put    %N
  901. Xdup 79 /Cru put    %O
  902. Xpop
  903. X/CharProcs 24 dict dup begin
  904. X/setC { 0 -50 -250 500 1000 setcachedevice} def
  905. X/C.bv {220 -250 moveto 0 1000 rlineto
  906. X60 0 rlineto 0 -1000 rlineto fill } def
  907. X/C.barc { 750 moveto 180 0 rlineto 0 -60 rlineto -180 0 rlineto fill } def
  908. X/C.barf { -250 moveto 180 0 rlineto 0 60 rlineto -180 0 rlineto fill } def
  909. X/C.brk.end { 1 setlinewidth moveto rlineto rcurveto
  910. Xreversepath 60 0 rlineto rlineto rcurveto fill } def
  911. X/C.setl {dup dtransform exch round exch idtransform pop setlinewidth } def
  912. X/Cbv {
  913. X300 setC
  914. XC.bv
  915. X} def
  916. X/Clt {
  917. X300 setC
  918. X  0 150 50 210 140 250   0 730  0 150 50 250 200 250   0 750   220 -250   C.brk.end
  919. X} def
  920. X/Clk {
  921. X300 setC
  922. X  1 setlinewidth  220 -250 moveto  0 400 rlineto  0 50 -50 100 -100 100 rcurveto  50 0 100 50 100 100 rcurveto  0 400 rlineto  60 0 rlineto  0 -400 rlineto  0 -50 -50 -100 -100 -100 rcurveto  50 0 100 -50 100 -100 rcurveto  0 -400 rlineto  closepath fill
  923. X} def
  924. X/Clb {
  925. X300 setC
  926. X  0 -150 50 -210 140 -250   0 -730  0 -150 50 -250 200 -250   0 -750   220 750   C.brk.end
  927. X} def
  928. X/Crt {
  929. X300 setC
  930. X  0 150 -50 250 -200 250   0 750   0 150 -50 210 -140 250   0 730  220 -250   C.brk.end
  931. X} def
  932. X/Crk {
  933. X300 setC
  934. X  1 setlinewidth  220 -250 moveto  0 400 rlineto  0 50 50 100 100 100 rcurveto  -50 0 -100 50 -100 100 rcurveto  0 400 rlineto  60 0 rlineto  0 -400 rlineto  0 -50 50 -100 100 -100 rcurveto  -50 0 -100 -50 -100 -100 rcurveto  0 -400 rlineto  fill
  935. X} def
  936. X/Crb {
  937. X300 setC
  938. X  0 -150 -50 -250 -200 -250   0 -750   0 -150 -50 -210 -140 -250   0 -730  220 750   C.brk.end
  939. X} def
  940. X/Clc {
  941. X300 setC
  942. X  C.bv   280   C.barc
  943. X} def
  944. X/Clf {
  945. X300 setC
  946. X  C.bv 280 C.barf
  947. X} def
  948. X/Crc {
  949. X300 setC
  950. X  C.bv 40 C.barc
  951. X} def
  952. X/Crf {
  953. X300 setC
  954. X  C.bv 40 C.barf
  955. X} def
  956. X/Cbr {
  957. X0 0 -50 -250 0 1000 setcachedevice
  958. X  40 C.setl  0 -250 moveto  0 1000 rlineto  stroke
  959. X} def
  960. X/Cru {
  961. X0 0 -50 -250 1000 0 setcachedevice
  962. X  40 C.setl  0 -250 moveto 500 0 rlineto stroke
  963. X} def
  964. X/Crn {
  965. X300 setC
  966. X  40 C.setl  0 895 moveto  500 0 rlineto  stroke
  967. X} def
  968. X/Cci {
  969. X600 0 -50 -250 700 1000 setcachedevice
  970. X  40 C.setl  400 250   300   0 360 arc   stroke
  971. X} def
  972. Xend def
  973. X/BuildChar
  974. X{
  975. X    $workingdict begin
  976. X    /charcode exch def
  977. X    /fontdict exch def
  978. X    fontdict /CharProcs get begin
  979. X    fontdict /Encoding get
  980. X    charcode get load
  981. X    gsave
  982. X    0 setlinecap 0 setgray newpath
  983. X    exec
  984. X    grestore
  985. X    end end
  986. X} def end
  987. X/BracketFont BracketFontDict definefont pop
  988. X
  989. X%    This macro is invoked by ShowPage to display the current form.
  990. X%    Usually redefined to point at a form loaded by an include
  991. X%    directive.  Redefinition triggered by .sR O<formname> troff
  992. X%    directive.
  993. X%    Global default form (usually redefined top of each page anyways)
  994. X/Form {} def
  995. X%    This is a convenient place for putting your extra inclusions.
  996. X%    Eg: this would load conf.ps (from current directory or LIBDIR)
  997. X%    and insert it into the end of the prolog.
  998. X%   This loads the confidential form.
  999. X%%%include confid
  1000. X%%%include lethead
  1001. END_OF_FILE
  1002. if test 9920 -ne `wc -c <'lib.ps'`; then
  1003.     echo shar: \"'lib.ps'\" unpacked with wrong size!
  1004. fi
  1005. # end of 'lib.ps'
  1006. fi
  1007. if test -f 'lj.c' -a "${1}" != "-c" ; then 
  1008.   echo shar: Will not clobber existing file \"'lj.c'\"
  1009. else
  1010. echo shar: Extracting \"'lj.c'\" \(9120 characters\)
  1011. sed "s/^X//" >'lj.c' <<'END_OF_FILE'
  1012. X/*    Copyright 1985, 1986, 1987, 1988 Chris Lewis
  1013. X        All Rights Reserved
  1014. X
  1015. X    Permission to copy and further distribute is freely given provided 
  1016. X    this copyright notice remains intact and that this software is not 
  1017. X    sold for profit.
  1018. X
  1019. X    Project:    Generic Troff drivers
  1020. X    Module:        lj.c
  1021. X    Author:     Chris Lewis
  1022. X    Specs:        LaserJet driver, hacked from ps.c and lcat.c
  1023. X            (Gosh, this is a lot simpler than lcat's stuff.
  1024. X            Thank PostScript for getting my brain in order.)
  1025. X
  1026. X            Font downloading is supported, but untested as
  1027. X            yet.
  1028. X            Font downloading is not supported yet, however
  1029. X            all of the font selection stuff is.  Therefore,
  1030. X            this stuff will actually work if all of the
  1031. X            fonts have been previously downloaded...
  1032. X            However, the LJ considers different point sizes
  1033. X            to be different fonts, so don't expect much....
  1034. X
  1035. X            Macro "DOWNLOAD" is used to denote places and
  1036. X            some coding for font downloading.
  1037. X
  1038. X            Without font downloading, this is LJ compatible.
  1039. X            Font downloading will require a LJ+, LJ500+ or
  1040. X            LJ II.
  1041. X
  1042. X            This code has not been tested - however, it is
  1043. X            a derivitive of the original lcat software, so
  1044. X            it may actually do things right.  Chances are,
  1045. X            any errors are in some of the escape sequence
  1046. X            details.  Eg: the stroke-weight parameter may
  1047. X            need tweaking.
  1048. X
  1049. X            Only standardFont bears any resemblance to what it
  1050. X            should.  symbolFont is still PostScript.
  1051. X
  1052. X            The tables have been moved from this file to
  1053. X            ljtables.c
  1054. X*/
  1055. X
  1056. X#include "defs.h"
  1057. X
  1058. X#if    defined(LJ) || defined(LK)
  1059. X#include "lj.h"
  1060. X
  1061. X#define    MAXFONT    50
  1062. X
  1063. X#ifndef    SVR3
  1064. X#ifndef    lint
  1065. Xstatic char SCCSid[] = "@(#)lj.c: 1.7 Copyright 89/06/14 17:40:23 Chris Lewis";
  1066. X#endif
  1067. X#else
  1068. X#ident  "@(#)lj.c: 1.7 Copyright 89/06/14 17:40:23 Chris Lewis" /*(SVR3)*/
  1069. X#endif
  1070. X
  1071. X#define    USED    1
  1072. X#define    BUILTIN 2
  1073. Xstruct ljFts {
  1074. X    char *troffName;
  1075. X    char *fontSeq;
  1076. X    char *ascName;
  1077. X    int     flags;
  1078. X} ljFts[MAXFONT+1];
  1079. X
  1080. Xstruct ljFts *t2ljf[8];
  1081. X
  1082. X/*    Used for characters not in Roman8 Character set */
  1083. X#define    NOPE    "\0374"
  1084. XljPage() {
  1085. X    printf("\033&l0H");
  1086. X    pagePending = 1;
  1087. X}
  1088. X
  1089. Xstatic
  1090. XdoPageStart(e) {
  1091. X    currentPage++;
  1092. X    pagePending = 0;
  1093. X}
  1094. X
  1095. Xstatic int lastFont = (-1), lastPoints = (-1);
  1096. Xstatic
  1097. Xputoct(s)
  1098. Xchar *s; {
  1099. X    int d;
  1100. X    if (strlen(s) < 3) {
  1101. X    fprintf(stderr, "%s: octal sequence in fonts.l[kj] bad\n", progname);
  1102. X    exit(1);
  1103. X    }
  1104. X    d = (*s - '0') * 64 + (*(s+1) - '0') * 8 + *(s+2) - '0';
  1105. X    putchar(d);
  1106. X}
  1107. X
  1108. XljSetFont(font, points)
  1109. Xint font, points; {
  1110. X
  1111. X    if (lastPoints != points || font != lastFont) {
  1112. X        register char *p;
  1113. X#ifdef    DOWNLOAD
  1114. X        if (!(ljFts[font].flags&(USED|BUILTIN))) {
  1115. X        char buf[512];
  1116. X        FILE *fontfile;
  1117. X        int count;
  1118. X        sprintf(buf, "%s/%s.%s.%d", LIBDIR, be->bename,
  1119. X            ljFts[font].troffName, points);
  1120. X        if ((fontfile = fopen(buf, "r")) == NULL) {
  1121. X            fprintf(stderr, "%s: Cannot open fontfile %s\n", progname,
  1122. X            buf);
  1123. X        } else {
  1124. X            while(0 > (count = fread(buf, sizeof(char), 512, fontfile)))
  1125. X            fwrite(buf, sizeof(char), count, stdout);
  1126. X            fclose(fontfile);
  1127. X        }
  1128. X        }
  1129. X#endif
  1130. X        ljFts[font].flags |= USED;
  1131. X        for (p = ljFts[font].fontSeq; *p; p++) {
  1132. X        if (*p == '\\') {
  1133. X            putoct(p+1);
  1134. X            p+=3;
  1135. X        } else
  1136. X            putchar(*p);
  1137. X        }
  1138. X        printf("\033(s%dV", points);
  1139. X        lastPoints = points;
  1140. X        lastFont = font;
  1141. X    }
  1142. X
  1143. X}
  1144. X
  1145. XljChar(x, y, font, points, troffChar) 
  1146. Xint x, y, font, points, troffChar; {
  1147. X    static double lasty = (-1);
  1148. X    register double nx = TROFF2LJX(x), ny = TROFF2LJY(y);
  1149. X    register struct troff2befont *rp;
  1150. X    register char *sequence = "a";
  1151. X    double xad, yad;
  1152. X    if (pagePending) {
  1153. X        lasty = lastFont = lastPoints = (-1);
  1154. X        doPageStart();
  1155. X    }
  1156. X
  1157. X    DEBUGPRINTF("x,y=%d,%d; font=%d, points=%d, tc=%d\n",
  1158. X        x, y, font, points, troffChar);
  1159. X
  1160. X    if (font == 3) {
  1161. X        rp = &be->besymfont[troffChar];
  1162. X    } else {
  1163. X        rp = &be->bestdfont[troffChar];
  1164. X    }
  1165. X
  1166. X    switch(rp->t2b_font) {
  1167. X        /* Only fonts with "U" are subject to font translation */
  1168. X        case U: 
  1169. X        if (font == 3)
  1170. X            font = 0;    /* Special chars are Courier */
  1171. X        else {
  1172. X            DEBUGPRINTF("ljSetChar %d->%s (%s)\n", font, 
  1173. X            t2ljf[font]->troffName,
  1174. X            t2ljf[font]->ascName);
  1175. X            font = t2ljf[font] - ljFts;
  1176. X        }
  1177. X        break;
  1178. X        case S: 
  1179. X        font = 3;
  1180. X        break;
  1181. X        case D:
  1182. X        break;
  1183. X        default:
  1184. X        /* Typically used when the main fonts don't have the
  1185. X           character desired.  Eg: right-hand is in the
  1186. X           ZapfDingbats font */
  1187. X        font = rp->t2b_font;
  1188. X        break;
  1189. X    }
  1190. X
  1191. X    sequence = rp->t2b_charseq;
  1192. X
  1193. X    if (!sequence) {
  1194. X        fprintf(stderr, "No coding for %d\n", troffChar);
  1195. X        return;
  1196. X    }
  1197. X
  1198. X    /*    We're committed now */
  1199. X
  1200. X    points *= rp->t2b_scale;
  1201. X    xad = points * rp->t2b_xc;
  1202. X    yad = points * rp->t2b_yc;
  1203. X    ljSetFont(font, points);
  1204. X
  1205. X/*    We won't output fractions */
  1206. X#define    XYS    "\033&a%.0fh%.0fV%s"
  1207. X#define    XS    "\033&a%.0fH%s"
  1208. X
  1209. X    if (lasty != ny) {
  1210. X        printf(XYS, nx+xad, ny+yad, sequence);
  1211. X        lasty = ny;
  1212. X    } else
  1213. X        printf(XS, nx+xad, sequence);
  1214. X}
  1215. X
  1216. Xstatic
  1217. Xloadfontdefs(f)
  1218. XFILE *f; {
  1219. X    struct ljFts *p = ljFts;
  1220. X    extern char *malloc();
  1221. X    int flags;
  1222. X    char rbuf[512], nbuf[512], ljbuf[512], seqbuf[512];
  1223. X    while(fgets(rbuf, sizeof(rbuf), f)) {
  1224. X    if (rbuf[0] == '#')
  1225. X        continue;
  1226. X    switch(sscanf(rbuf, "%s%s%s%d", nbuf, ljbuf, seqbuf, &flags)) {
  1227. X        default:
  1228. X        break;
  1229. X        case 4:
  1230. X        if (nbuf[0] == '#')
  1231. X            break;
  1232. X        if (p - ljFts >= MAXFONT) {
  1233. X            fprintf(stderr, "Too many font definitions in %s\n",
  1234. X            be->bename);
  1235. X            exit(1);
  1236. X        }
  1237. X        p->troffName = malloc(strlen(nbuf) + 1);
  1238. X        strcpy(p->troffName, nbuf);
  1239. X        p->ascName = malloc(strlen(ljbuf) + 1);
  1240. X        strcpy(p->ascName, ljbuf);
  1241. X        p->fontSeq = malloc(strlen(seqbuf) + 1);
  1242. X        strcpy(p->fontSeq, seqbuf);
  1243. X        p->flags = flags;
  1244. X        p++;
  1245. X    }
  1246. X    }
  1247. X#ifdef    DEBUG
  1248. X    for (p = ljFts; p->troffName; p++)
  1249. X    DEBUGPRINTF("%s -> %s, seq: %s\n", p->troffName, p->ascName, p->fontSeq);
  1250. X#endif
  1251. X}
  1252. X
  1253. XljProlog() {
  1254. X    extern char *getlogin(), *ctime();
  1255. X    char *buf2[15];
  1256. X    FILE *library;
  1257. X    int c;
  1258. X    long curtime;
  1259. X
  1260. X    currentPage = 0;
  1261. X    pagePending = 1;
  1262. X
  1263. X    for (c = 0; c < 8; c++)
  1264. X    t2ljf[c] = &ljFts[c];
  1265. X
  1266. X    sprintf(buf2, "%s.%s", LJFONTS, be->bename);
  1267. X
  1268. X    if ((library = fopen(buf2, "r")) == NULL) {
  1269. X    char buffer[512];
  1270. X    sprintf(buffer, "%s/%s", LIBDIR, buf2);
  1271. X    if ((library = fopen(buffer, "r")) == NULL) {
  1272. X        fprintf(stderr, "Cannot open %s font definitions %s\n",
  1273. X        LJFONTS, buffer);
  1274. X        exit(1);
  1275. X    }
  1276. X    }
  1277. X
  1278. X    loadfontdefs(library);
  1279. X    fclose(library);
  1280. X
  1281. X    sprintf(buf2, "%s.%s", LJLIB, be->bename);
  1282. X
  1283. X    if ((library = fopen(buf2, "r")) == NULL) {
  1284. X    char buffer[512];
  1285. X    sprintf(buffer, "%s/%s", LIBDIR, buf2);
  1286. X    if ((library = fopen(buffer, "r")) == NULL) {
  1287. X        fprintf(stderr, "Cannot open %s\n", buffer);
  1288. X        exit(1);
  1289. X    }
  1290. X    }
  1291. X
  1292. X    printf("\033E\033&k2G");    /* reset printer, set CR=CR,LF=CRLF,FF=CRFF */
  1293. X    printf("\033&l6d66p0o0e66f0L");/* letter size, portrait, no perf skip */
  1294. X    printf("\0339");        /* reset side margins */
  1295. X    printf("\033&a0r0C");    /* move cursor to 0,0 */
  1296. X
  1297. X    ljXlate(library);
  1298. X    fclose(library);
  1299. X}
  1300. X
  1301. XljEpilog() {
  1302. X}
  1303. X
  1304. XljFontSel(from, to)
  1305. Xchar from, *to; {
  1306. X#ifdef    DEBUG
  1307. X    register int i;
  1308. X    register struct ljFts *p;
  1309. X#endif
  1310. X    DEBUGPRINTF("ljFontSel: %c -> %s\n", from, to);
  1311. X    if (from < '1' || from > '8') {
  1312. X    fprintf(stderr, "Bad arguments to ljFontSel: %c %s\n", from, to);
  1313. X    return;
  1314. X    }
  1315. X
  1316. X    for (p = ljFts; p->troffName; p++)
  1317. X    if (strcmp(p->troffName, to) == 0) {
  1318. X        t2ljf[from - '1'] = p;
  1319. X        break;
  1320. X    }
  1321. X    if (!p->troffName) {
  1322. X    fprintf(stderr, "Could not translate font %c (%s)\n", from, to);
  1323. X    }
  1324. X#ifdef    DEBUG
  1325. X    for (i = 0; i < 8; i++)
  1326. X    DEBUGPRINTF("Font %d->%s\n", i+1, t2ljf[i]->ascName);
  1327. X#endif
  1328. X}
  1329. X
  1330. X/*    Copy the library file to the standard output, stripping
  1331. X    %line\n
  1332. X    %%%<something> is a metadirective
  1333. X    and converting \nnn and \xnn as you go.
  1334. X    Strip out line termination.
  1335. X*/
  1336. X
  1337. XljXlate(library)
  1338. XFILE *library; {
  1339. X    char buf[4];
  1340. X    int c, i;
  1341. X    c = getc(library);
  1342. X    while(!feof(library)) {
  1343. X
  1344. X      nextchar:
  1345. X
  1346. X    switch(c) {
  1347. X        case '%':
  1348. X        /* strip from percent sign to end of line */
  1349. X        /* If line is %%%<something> pass onto interp */
  1350. X        if (((c = getc(library)) == '%') &&
  1351. X            ((c = getc(library)) == '%')) {
  1352. X            char buf2[4];
  1353. X            sprintf(buf2, ".%s", be->bename);
  1354. X            fgets(buf, strlen(buf), library);
  1355. X            interp(buf, ljXlate, buf2);
  1356. X            break;
  1357. X        }
  1358. X        while ((c = getc(library)) != EOF && c != '\n');
  1359. X        break;
  1360. X        case '\n':    /* throw away real newlines. */
  1361. X        break;
  1362. X        case '\\':
  1363. X        c = getc(library);
  1364. X        if (c == 'x' || c == 'X') {
  1365. X            i = 0;
  1366. X            while(1) {
  1367. X            c = getc(library);
  1368. X
  1369. X            if (c == EOF || !((c >= '0' && c <= '9') ||
  1370. X                      (c >= 'A' && c <= 'F') ||
  1371. X                      (c >= 'a' && c <= 'f')))
  1372. X                goto nextchar;
  1373. X
  1374. X            buf[i++] = c;
  1375. X            if (i == 2) {
  1376. X                buf[i] = '\0';
  1377. X                sscanf(buf, "%x", &i);
  1378. X                putchar(i);
  1379. X                i = 0;
  1380. X            }
  1381. X            }
  1382. X        } else {
  1383. X            buf[0] = c;
  1384. X            i = 1;
  1385. X            while(1) {
  1386. X            c = getc(library);
  1387. X            if (c == EOF || c < '0' || c > '7')
  1388. X                goto nextchar;
  1389. X            buf[i++] = c;
  1390. X            if (i == 3) {
  1391. X                buf[i] = '\0';
  1392. X                sscanf(buf, "%o", &i);
  1393. X                putchar(i);
  1394. X                i = 0;
  1395. X            }
  1396. X            }
  1397. X        }
  1398. X        /* NOTREACHED */
  1399. X
  1400. X        case ' ': case '\t':
  1401. X        break;
  1402. X
  1403. X        case EOF:
  1404. X        fprintf(stderr, "%s: Unexpected eof on ljlib\n", progname);
  1405. X        break;
  1406. X
  1407. X        default:
  1408. X        putchar(c);
  1409. X    }
  1410. X    c = getc(library);
  1411. X    }
  1412. X}
  1413. X#endif
  1414. END_OF_FILE
  1415. if test 9120 -ne `wc -c <'lj.c'`; then
  1416.     echo shar: \"'lj.c'\" unpacked with wrong size!
  1417. fi
  1418. # end of 'lj.c'
  1419. fi
  1420. if test -f 'troff2.c' -a "${1}" != "-c" ; then 
  1421.   echo shar: Will not clobber existing file \"'troff2.c'\"
  1422. else
  1423. echo shar: Extracting \"'troff2.c'\" \(11128 characters\)
  1424. sed "s/^X//" >'troff2.c' <<'END_OF_FILE'
  1425. X/*    Copyright 1985, 1986, 1987, 1988 Chris Lewis
  1426. X        All Rights Reserved
  1427. X
  1428. X    Permission to copy and further distribute is freely given provided 
  1429. X    this copyright notice remains intact and that this software is not 
  1430. X    sold for profit.
  1431. X
  1432. X    Project:    Generic Troff drivers
  1433. X    Module:        troff2.c
  1434. X    Author:     Chris Lewis
  1435. X    Specs:        Troff interpreter, needs a driver to work.
  1436. X */
  1437. X
  1438. X#include "defs.h"
  1439. X
  1440. X#ifndef    SVR3
  1441. X#ifndef    lint
  1442. Xstatic char SCCSid[] = "@(#)troff2.c: 1.16 Copyright 89/07/17 10:58:29 Chris Lewis";
  1443. X#endif
  1444. X#else
  1445. X#ident  "@(#)troff2.c: 1.16 Copyright 89/07/17 10:58:29 Chris Lewis"
  1446. X#endif
  1447. X
  1448. X#define    ESC    0x80
  1449. X#define    FLASH    0x00
  1450. X#define    CONTROL    0x40
  1451. X#define    LEAD    0x60
  1452. X#define    SIZE    0x50
  1453. X
  1454. X#define    DOWN    0
  1455. X#define    UP    1
  1456. X#define    LOWER    2
  1457. X#define    UPPER    3
  1458. X#define    FORWARD    4
  1459. X#define    BACKWARD 5
  1460. X
  1461. Xchar ptab[15] = { 7, 8, 10, 11, 12, 14, 18, 9, 6, 16, 20, 22, 24, 28, 36};
  1462. Xint    points;
  1463. X
  1464. Xlong    xpos, ypos;
  1465. X
  1466. Xchar *words[] = {
  1467. X    "down", "up", "lower", "upper", "forward", "backwards"
  1468. X    };
  1469. X
  1470. X
  1471. X#define    CTOINT(val,sig)    ((~c)&sig)
  1472. X
  1473. Xdouble pagelength = 11 * TROFFRESOLUTION;
  1474. X
  1475. X#define    CFONT (((mag == UPPER)<<2)|((rail == UPPER)<<1)|(tilt==DOWN))
  1476. X#ifdef    FONT4
  1477. X#define    calcfont    font = (CFONT >> 1)
  1478. X#else
  1479. X#define    calcfont    font = CFONT
  1480. X#endif
  1481. X
  1482. Xchar *progname;
  1483. Xchar *device = {"alw"};
  1484. X
  1485. Xdouble calc();
  1486. X
  1487. Xchar *driver;
  1488. X
  1489. Xmain(argc, argv)
  1490. Xint    argc;
  1491. Xchar    **argv; {
  1492. X    register int nc, c;
  1493. X    register int i,j;
  1494. X    register int units;
  1495. X    register int font, rail, mag, tilt, half, escape, lead;
  1496. X
  1497. X    extern int getopt();
  1498. X    extern char *optarg;
  1499. X
  1500. X    progname = strrchr(argv[0], "/");
  1501. X    if (progname)
  1502. X        progname++;
  1503. X    else
  1504. X        progname = argv[0];
  1505. X    
  1506. X    if (strlen(progname) >= 2)
  1507. X        driver = progname + strlen(progname) - 2;
  1508. X    else
  1509. X        driver = "ZZ";
  1510. X
  1511. X    while((c = getopt(argc, argv, "T:VDd:l:m")) != EOF)
  1512. X        switch (c) {
  1513. X        case 'T':
  1514. X            device = optarg;
  1515. X            break;
  1516. X        case 'm':
  1517. X            metrics = 1;
  1518. X            break;
  1519. X        case 'V':
  1520. X            printf("%s: version %s\n", progname, T2VERSION);
  1521. X            exit(0);
  1522. X        case 'D':
  1523. X            diagFile = fopen("diagnostics", "w");
  1524. X            if (!diagFile) {
  1525. X            fprintf(stderr, "%s: Could not open diagnostics file\n",
  1526. X                progname);
  1527. X            exit(1);
  1528. X            }
  1529. X            break;
  1530. X        case 'd':
  1531. X            driver = optarg;
  1532. X            break;
  1533. X        case 'l':
  1534. X            pagelength = calc(optarg);
  1535. X            if (pagelength == 0) {
  1536. X            fprintf(stderr, "%s: Bad pagelength %s\n", progname, 
  1537. X                optarg);
  1538. X            exit(1);
  1539. X            }
  1540. X            break;
  1541. X        case '?':
  1542. X        default:
  1543. X            usage();
  1544. X            exit(1);
  1545. X        }
  1546. X    
  1547. X    getdriver(driver);
  1548. X
  1549. X    if (be->beprolog)
  1550. X        (*be->beprolog)();
  1551. X
  1552. X    while (!feof(stdin)) {
  1553. X        c = getc(stdin);
  1554. X        switch(c) {
  1555. X        case 0x00:
  1556. X            DEBUGPRINTF("NOP\n");
  1557. X            break;
  1558. X        /* Flash (print character) codes */
  1559. X        case 0x01: case 0x02: case 0x03: case 0x04: 
  1560. X        case 0x05: case 0x06: case 0x07: case 0x08: 
  1561. X        case 0x09: case 0x0a: case 0x0b: case 0x0c: 
  1562. X        case 0x0d: case 0x0e: case 0x0f: case 0x10: 
  1563. X        case 0x11: case 0x12: case 0x13: case 0x14:
  1564. X        case 0x15: case 0x16: case 0x17: case 0x18: 
  1565. X        case 0x19: case 0x1a: case 0x1b: case 0x1c: 
  1566. X        case 0x1d: case 0x1e: case 0x1f: case 0x20: 
  1567. X        case 0x21: case 0x22: case 0x23: case 0x24: 
  1568. X        case 0x25: case 0x26: case 0x27: case 0x28:
  1569. X        case 0x29: case 0x2a: case 0x2b: case 0x2c: 
  1570. X        case 0x2d: case 0x2e: case 0x2f: case 0x30: 
  1571. X        case 0x31: case 0x32: case 0x33: case 0x34: 
  1572. X        case 0x35: case 0x36: case 0x37: case 0x38: 
  1573. X        case 0x39: case 0x3a: case 0x3b: case 0x3c:
  1574. X        case 0x3d: case 0x3e: case 0x3f:
  1575. X            /* This is terribly kludgey:
  1576. X                In 432 units per inch, 4752 is 11 inches.
  1577. X                When we go beyond this, we subtract 4752
  1578. X                continually until we're back in range.
  1579. X            */
  1580. X            while (ypos >= pagelength) {
  1581. X                   ypos -= pagelength;
  1582. X                DEBUGPRINTF("Page break\n", 0, 0);
  1583. X                if (be->bepage)
  1584. X                (be->bepage) ();
  1585. X            }
  1586. X            c = c&0x3f;
  1587. X            /*    Find the C/A/T code */
  1588. X            if (half == UPPER) {
  1589. X                if (c > 46) {
  1590. X                fprintf(stderr, "%s: Illegal upper flash: %d\n", 
  1591. X                    progname, c);
  1592. X                exit(1);
  1593. X                }
  1594. X                nc = c + 62;
  1595. X            } else
  1596. X                nc = c - 1;
  1597. X
  1598. X            DEBUGPRINTF("nc=%d;pnts=%d;x,y=%ld,%ld;fnt=%d;",
  1599. X                nc,points,xpos,ypos,font);
  1600. X            DEBUGPRINTF("rail=%s;mag=%s;tilt=%s;half=%s\n",
  1601. X                words[rail], words[mag],words[tilt], words[half]);
  1602. X
  1603. X            if (be->beputchar)
  1604. X                (*be->beputchar)(xpos, ypos, font, points, nc);
  1605. X            
  1606. X            break;
  1607. X        /* Control codes */
  1608. X        case 0x40:
  1609. X            DEBUGPRINTF("Initialize\n");
  1610. X            xpos = 0;
  1611. X            ypos = -153;
  1612. X            escape = FORWARD;
  1613. X            lead = FORWARD;
  1614. X            half = LOWER;
  1615. X            rail = LOWER;
  1616. X            mag = LOWER;
  1617. X            tilt = DOWN;
  1618. X            calcfont;
  1619. X            break;
  1620. X        case 0x41:
  1621. X            DEBUGPRINTF("Rail lower\n");
  1622. X            rail = LOWER;
  1623. X            calcfont;
  1624. X            break;
  1625. X        case 0x42:
  1626. X            DEBUGPRINTF("Rail upper\n");
  1627. X            rail = UPPER;
  1628. X            calcfont;
  1629. X            break;
  1630. X        case 0x43:
  1631. X            DEBUGPRINTF("Mag upper\n");
  1632. X            mag = UPPER;
  1633. X            calcfont;
  1634. X            break;
  1635. X        case 0x44:
  1636. X            DEBUGPRINTF("Mag lower\n");
  1637. X            mag = LOWER;
  1638. X            calcfont;
  1639. X            break;
  1640. X        case 0x45:
  1641. X            DEBUGPRINTF("half lower\n");
  1642. X            half = LOWER;
  1643. X            break;
  1644. X        case 0x46:
  1645. X            DEBUGPRINTF("half upper\n");
  1646. X            half = UPPER;
  1647. X            break;
  1648. X        case 0x47:
  1649. X            DEBUGPRINTF("Escape forward\n");
  1650. X            escape = FORWARD;
  1651. X            break;
  1652. X        case 0x48:
  1653. X            DEBUGPRINTF("Escape backward\n");
  1654. X            escape = BACKWARD;
  1655. X            break;
  1656. X        case 0x49:
  1657. X            DEBUGPRINTF("STOP\n");
  1658. X            break;
  1659. X        case 0x4a:
  1660. X            DEBUGPRINTF("Lead forward\n");
  1661. X            lead = FORWARD;
  1662. X            break;
  1663. X        case 0x4b:
  1664. X            DEBUGPRINTF("Software cut!\n");
  1665. X            break;
  1666. X        case 0x4c:
  1667. X            DEBUGPRINTF("Lead backward\n");
  1668. X            lead = BACKWARD;
  1669. X            break;
  1670. X        case 0x4d: 
  1671. X#ifdef    SPECIAL
  1672. X#define    SPSIZ    256
  1673. X            {
  1674. X                static char specialbuf[SPSIZ], *sbp;
  1675. X                sbp = specialbuf;
  1676. X                while((c = getc(stdin)) != EOF && c != '\n') {
  1677. X                if (sbp < &specialbuf[SPSIZ]-2)
  1678. X                *sbp++ = c;
  1679. X                }
  1680. X                *sbp = '\0';
  1681. X                
  1682. X                DEBUGPRINTF("SPECIAL SEQUENCE: %s!\n", specialbuf);
  1683. X                dospecial(specialbuf);
  1684. X                break;
  1685. X            }
  1686. X#else
  1687. X            fprintf(stderr, "%s: Illegal C/A/T code - %s\n",
  1688. X                progname, "special sequences are disabled");
  1689. X            exit(1);
  1690. X#endif
  1691. X        case 0x4e:
  1692. X            DEBUGPRINTF("Tilt up\n");
  1693. X            tilt = UP;
  1694. X            calcfont;
  1695. X            break;
  1696. X        case 0x4f:
  1697. X            DEBUGPRINTF("Tilt down\n");
  1698. X            tilt = DOWN;
  1699. X            calcfont;
  1700. X            break;
  1701. X
  1702. X        /* Size changes */
  1703. X        case 0x50: case 0x51: case 0x52: case 0x53:
  1704. X        case 0x54: case 0x55: case 0x56: case 0x57:
  1705. X        case 0x58: case 0x59: case 0x5a: case 0x5b:
  1706. X        case 0x5c: case 0x5d: case 0x5e: case 0x5f:
  1707. X            /* basic code is the points = ptab[c] line.
  1708. X               The rest of the brain-damage is due to the
  1709. X               fact that switching from some of the fonts
  1710. X               to some of the others blow the horizontal
  1711. X               position - see the cat(5) manual page
  1712. X               about single vs. doubler point sizes. */
  1713. X            {    static lastc = 0;
  1714. X            c &= 0xf;
  1715. X            points = ptab[c];
  1716. X
  1717. X            DEBUGPRINTF("SPoints:%d;lastc:%5d;c:%d;xpos:%d\n", 
  1718. X                points, lastc, c, xpos);
  1719. X            if (lastc <= 8 && c > 8) /* single -> doubler */
  1720. X                xpos -= 55;
  1721. X            else if (lastc > 8 && c <= 8) /* doubler -> single */
  1722. X                xpos += 55;
  1723. X
  1724. X            DEBUGPRINTF("EPoints:%d;lastc:%5d;c:%d;xpos:%d\n", 
  1725. X                points, lastc, c, xpos);
  1726. X            lastc = c;
  1727. X            break;
  1728. X            }
  1729. X        /* Lead (vertical motion) codes */
  1730. X        case 0x60: case 0x61: case 0x62: case 0x63:
  1731. X        case 0x64: case 0x65: case 0x66: case 0x67:
  1732. X        case 0x68: case 0x69: case 0x6a: case 0x6b:
  1733. X        case 0x6c: case 0x6d: case 0x6e: case 0x6f:
  1734. X        case 0x70: case 0x71: case 0x72: case 0x73:
  1735. X        case 0x74: case 0x75: case 0x76: case 0x77:
  1736. X        case 0x78: case 0x79: case 0x7a: case 0x7b:
  1737. X        case 0x7c: case 0x7d: case 0x7e: case 0x7f:
  1738. X
  1739. X            DEBUGPRINTF("Lead(vertical) %02x\n", c&0x1f);
  1740. X            units = CTOINT(c,0x1f);
  1741. X            if (lead == FORWARD)
  1742. X                ypos += 3*units;
  1743. X            else
  1744. X                ypos -= 3*units;
  1745. X            break;
  1746. X        /* Escape (horizontal motion) codes */
  1747. X        case 0x80: case 0x81: case 0x82: case 0x83:
  1748. X        case 0x84: case 0x85: case 0x86: case 0x87:
  1749. X        case 0x88: case 0x89: case 0x8a: case 0x8b:
  1750. X        case 0x8c: case 0x8d: case 0x8e: case 0x8f:
  1751. X        case 0x90: case 0x91: case 0x92: case 0x93:
  1752. X        case 0x94: case 0x95: case 0x96: case 0x97:
  1753. X        case 0x98: case 0x99: case 0x9a: case 0x9b:
  1754. X        case 0x9c: case 0x9d: case 0x9e: case 0x9f:
  1755. X        case 0xa0: case 0xa1: case 0xa2: case 0xa3:
  1756. X        case 0xa4: case 0xa5: case 0xa6: case 0xa7:
  1757. X        case 0xa8: case 0xa9: case 0xaa: case 0xab:
  1758. X        case 0xac: case 0xad: case 0xae: case 0xaf:
  1759. X        case 0xb0: case 0xb1: case 0xb2: case 0xb3:
  1760. X        case 0xb4: case 0xb5: case 0xb6: case 0xb7:
  1761. X        case 0xb8: case 0xb9: case 0xba: case 0xbb:
  1762. X        case 0xbc: case 0xbd: case 0xbe: case 0xbf:
  1763. X        case 0xc0: case 0xc1: case 0xc2: case 0xc3:
  1764. X        case 0xc4: case 0xc5: case 0xc6: case 0xc7:
  1765. X        case 0xc8: case 0xc9: case 0xca: case 0xcb:
  1766. X        case 0xcc: case 0xcd: case 0xce: case 0xcf:
  1767. X        case 0xd0: case 0xd1: case 0xd2: case 0xd3:
  1768. X        case 0xd4: case 0xd5: case 0xd6: case 0xd7:
  1769. X        case 0xd8: case 0xd9: case 0xda: case 0xdb:
  1770. X        case 0xdc: case 0xdd: case 0xde: case 0xdf:
  1771. X        case 0xe0: case 0xe1: case 0xe2: case 0xe3:
  1772. X        case 0xe4: case 0xe5: case 0xe6: case 0xe7:
  1773. X        case 0xe8: case 0xe9: case 0xea: case 0xeb:
  1774. X        case 0xec: case 0xed: case 0xee: case 0xef:
  1775. X        case 0xf0: case 0xf1: case 0xf2: case 0xf3:
  1776. X        case 0xf4: case 0xf5: case 0xf6: case 0xf7:
  1777. X        case 0xf8: case 0xf9: case 0xfa: case 0xfb:
  1778. X        case 0xfc: case 0xfd: case 0xfe:
  1779. X
  1780. X            units = CTOINT(c,0x7f);
  1781. X            if (escape == FORWARD)
  1782. X                xpos += units;
  1783. X            else
  1784. X                xpos -= units;
  1785. X            DEBUGPRINTF("ESC (hor): %02x\n", c&0x7f);
  1786. X            break;
  1787. X
  1788. X        case 0xff:
  1789. X            DEBUGPRINTF("Illegal: %02x\n", c);
  1790. X            break;
  1791. X        }
  1792. X    }
  1793. X    if (be->bepage)
  1794. X        (*be->bepage)();
  1795. X    if (be->beepilog)
  1796. X        (*be->beepilog) ();
  1797. X    exit(0);
  1798. X}
  1799. X
  1800. Xusage() {
  1801. X    fprintf(stderr, "usage: %s [-D]\n", progname);
  1802. X}
  1803. X
  1804. Xdouble
  1805. Xcalc(s)
  1806. Xregister char *s; {
  1807. X    double retval = 0.0;
  1808. X    char scale;
  1809. X    switch (sscanf(s, "%lf%c", &retval, &scale)) {
  1810. X    case 0:
  1811. X    case EOF:
  1812. X        retval = 0.0;
  1813. X    case 1:
  1814. X        retval *= TROFFRESOLUTION; /* default is inches */
  1815. X        break;
  1816. X    case 2:
  1817. X        switch(scale) {
  1818. X        default:
  1819. X            fprintf(stderr, "%s: bad scale %c\n", scale);
  1820. X            retval = 0.0;
  1821. X        case 'i':
  1822. X            retval *= TROFFRESOLUTION;
  1823. X        case 'u':
  1824. X            break;
  1825. X        case 'c':
  1826. X            retval *= TROFFRESOLUTION * 50. / 127.;
  1827. X            break;
  1828. X        case 'P':
  1829. X            retval *= 72.;
  1830. X            break;
  1831. X        }
  1832. X        break;
  1833. X    }
  1834. X    return(retval);
  1835. X}
  1836. X
  1837. X#ifdef    SPECIAL
  1838. X
  1839. Xdospecial(string)
  1840. Xchar *string; {
  1841. X    char buffer[512];
  1842. X    char b2[4];
  1843. X    buffer[0] = '\0';
  1844. X
  1845. X    DEBUGPRINTF("Dospecial: (%d) %s\n", strlen(string), string);
  1846. X    while (*string)
  1847. X    switch(*string) {
  1848. X        case 'F':
  1849. X        /*if (parmchk(2, string))
  1850. X            return;*/
  1851. X        if (be->befontsel)
  1852. X            (*be->befontsel)(*(string+1), string+2);
  1853. X        *string ='\0';
  1854. X        return;
  1855. X#ifdef    FORM
  1856. X        case 'O':
  1857. X        if (be->beoverlay)
  1858. X            (*be->beoverlay)(string+1);
  1859. X        *string = '\0';
  1860. X        return;
  1861. X#endif
  1862. X        case 'i':
  1863. X        strcpy(buffer, "b");
  1864. X
  1865. X        case 'I':
  1866. X        strcat(buffer, "include ");
  1867. X        strcat(buffer, string+1);
  1868. X        strcpy(b2, ".");
  1869. X        strcat(b2, driver);
  1870. X        interp(buffer, (be->bexlat && *string == 'F') ? be->bexlat:
  1871. X            FNULL, b2);
  1872. X        return;
  1873. X
  1874. X        case 'B':
  1875. X        if (be->bebin)
  1876. X            (*be->bebin)(string+1);
  1877. X        string += 2;
  1878. X        break;
  1879. X        default:
  1880. X        fprintf(stderr, "%s: Illegal sequence %s\n", progname, string);
  1881. X        return;
  1882. X    }
  1883. X}
  1884. X
  1885. Xparmchk(cnt, string)
  1886. Xint cnt; char *string; {
  1887. X    register int i;
  1888. X    for (i = 0; i < cnt; i++)
  1889. X    if (!string[i]) {
  1890. X        fprintf(stderr, "%s: Bad %d parameter command: %s\n", progname,
  1891. X        cnt, string);
  1892. X        return(1);
  1893. X    }
  1894. X    return(0);
  1895. X}
  1896. X#endif
  1897. END_OF_FILE
  1898. if test 11128 -ne `wc -c <'troff2.c'`; then
  1899.     echo shar: \"'troff2.c'\" unpacked with wrong size!
  1900. fi
  1901. # end of 'troff2.c'
  1902. fi
  1903. echo shar: End of archive 4 \(of 6\).
  1904. cp /dev/null ark4isdone
  1905. MISSING=""
  1906. for I in 1 2 3 4 5 6 ; do
  1907.     if test ! -f ark${I}isdone ; then
  1908.     MISSING="${MISSING} ${I}"
  1909.     fi
  1910. done
  1911. if test "${MISSING}" = "" ; then
  1912.     echo You have unpacked all 6 archives.
  1913.     echo "Read README to install psroff"
  1914.     rm -f ark[1-9]isdone
  1915. else
  1916.     echo You still need to unpack the following archives:
  1917.     echo "        " ${MISSING}
  1918. fi
  1919. ##  End of shell archive.
  1920. exit 0
  1921.  
  1922.